this.BX=this.BX||{};(function(e,t,i){"use strict";var n=function e(){babelHelpers.classCallCheck(this,e)};babelHelpers.defineProperty(n,"DANGER","ui-counter-danger");babelHelpers.defineProperty(n,"WARNING","ui-counter-warning");babelHelpers.defineProperty(n,"SUCCESS","ui-counter-success");babelHelpers.defineProperty(n,"PRIMARY","ui-counter-primary");babelHelpers.defineProperty(n,"GRAY","ui-counter-gray");babelHelpers.defineProperty(n,"LIGHT","ui-counter-light");babelHelpers.defineProperty(n,"WHITE","ui-counter-white");babelHelpers.defineProperty(n,"DARK","ui-counter-dark");babelHelpers.defineProperty(n,"THEME","ui-counter-theme");var r=function e(){babelHelpers.classCallCheck(this,e)};babelHelpers.defineProperty(r,"SMALL","ui-counter-sm");babelHelpers.defineProperty(r,"LARGE","ui-counter-lg");babelHelpers.defineProperty(r,"MEDIUM","ui-counter-md");var s,o;function a(e,t){l(e,t);t.add(e)}function l(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function u(e,t,i){if(!t.has(e)){throw new TypeError("attempted to get private field on non-instance")}return i}var h=new WeakSet;var c=function(){function e(t){babelHelpers.classCallCheck(this,e);a(this,h);this.options=i.Type.isPlainObject(t)?t:{};this.container=null;this.counterContainer=null;this.animate=i.Type.isBoolean(this.options.animate)?this.options.animate:false;this.value=i.Type.isNumber(this.options.value)?this.options.value:0;this.maxValue=i.Type.isNumber(this.options.maxValue)?this.options.maxValue:99;this.size=i.Type.isString(this.options.size)?this.options.size:BX.UI.Counter.Size.MEDIUM;this.color=i.Type.isString(this.options.color)?this.options.color:BX.UI.Counter.Color.PRIMARY;this.border=i.Type.isBoolean(this.options.border)?this.options.border:false}babelHelpers.createClass(e,[{key:"setValue",value:function e(t){if(i.Type.isNumber(t)){this.value=t<0?0:t}return this}},{key:"getValue",value:function e(){if(this.value<=this.maxValue){return this.value}else{return this.maxValue+"+"}}},{key:"setMaxValue",value:function e(t){if(i.Type.isNumber(t)){this.value=t<0?0:t}return this}},{key:"getMaxValue",value:function e(){return this.maxValue}},{key:"isBorder",value:function e(){return this.border}},{key:"setColor",value:function e(t){if(i.Type.isStringFilled(t)){if(this.container===null){this.createContainer()}i.Dom.removeClass(this.container,this.color);this.color=t;i.Dom.addClass(this.container,this.color)}return this}},{key:"setSize",value:function e(t){if(i.Type.isStringFilled(t)){BX.removeClass(this.container,this.size);this.size=t;BX.addClass(this.container,this.size)}return this}},{key:"setAnimate",value:function e(t){if(i.Type.isBoolean(t)){this.animate=t}return this}},{key:"setBorder",value:function e(t){if(!i.Type.isBoolean(t)){console.warn('Parameter "border" is not boolean');return this}this.border=t;var n=u(this,h,f).call(this,t);if(t){i.Dom.addClass(this.container,n)}else{i.Dom.removeClass(this.container,n)}return this}},{key:"update",value:function e(t){if(this.container===null){this.createContainer()}if(this.animate==true){this.updateAnimated(t)}else if(this.animate==false){this.setValue(t);i.Dom.adjust(this.counterContainer,{text:this.getValue()})}}},{key:"updateAnimated",value:function e(t){if(this.container===null){this.createContainer()}if(t>this.value&&this.value<this.maxValue){i.Dom.addClass(this.counterContainer,"ui-counter-plus")}else if(t<this.value&&this.value<this.maxValue){i.Dom.addClass(this.counterContainer,"ui-counter-minus")}setTimeout(function(){this.setValue(t);i.Dom.adjust(this.counterContainer,{text:this.getValue()})}.bind(this),250);setTimeout(function(){i.Dom.removeClass(this.counterContainer,"ui-counter-plus");i.Dom.removeClass(this.counterContainer,"ui-counter-minus")}.bind(this),500)}},{key:"show",value:function e(){if(this.container===null){this.createContainer()}i.Dom.addClass(this.container,"ui-counter-show");i.Dom.removeClass(this.container,"ui-counter-hide")}},{key:"hide",value:function e(){if(this.container===null){this.createContainer()}i.Dom.addClass(this.container,"ui-counter-hide");i.Dom.removeClass(this.container,"ui-counter-show")}},{key:"getCounterContainer",value:function e(){if(this.counterContainer===null){this.counterContainer=i.Tag.render(s||(s=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-counter-inner">',"</div>\n\t\t\t"])),this.getValue())}return this.counterContainer}},{key:"createContainer",value:function e(){if(this.container===null){this.container=i.Tag.render(o||(o=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-counter">',"</div>\n\t\t\t"])),this.getCounterContainer());this.setSize(this.size);this.setColor(this.color);this.setBorder(this.border)}return this.container}},{key:"getContainer",value:function e(){if(this.container===null){this.createContainer()}return this.container}},{key:"renderTo",value:function e(t){if(i.Type.isDomNode(t)){return t.appendChild(this.getContainer())}return null}},{key:"destroy",value:function e(){i.Dom.remove(this.container);this.container=null;this.finished=false;this.textAfterContainer=null;this.textBeforeContainer=null;this.bar=null;this.svg=null;for(var t in this){if(this.hasOwnProperty(t)){delete this[t]}}Object.setPrototypeOf(this,null)}}]);return e}();function f(e){if(e){return"ui-counter-border"}else{return""}}babelHelpers.defineProperty(c,"Color",n);babelHelpers.defineProperty(c,"Size",r);e.Counter=c})(this.BX.UI=this.BX.UI||{},BX,BX);
//# sourceMappingURL=cnt.bundle.map.js